<div class="tab-pane active" id="action-pages">
  <table class='table table-simple table-spaced'>
    <% @actionPages.each do |action_page| -%>
      <tr>
        <td class="action-id hidden-xs"><span class="id-badge"><%= action_page.id -%></span></td>
        <td class="action-icons">
          <% if action_page.enable_call? %>
            <i class="icon ion-ios-telephone-outline has-tooltip" data-toggle="tooltip" data-placement="auto left" title="Phone tool"></i>
          <% end -%>
          <% if action_page.enable_petition? %>
            <i class="icon ion-ios-paper-outline has-tooltip" data-toggle="tooltip" data-placement="auto left" title="Petition tool"></i>
          <% end -%>
          <% if action_page.enable_email? %>
            <i class="icon ion-ios-email-outline has-tooltip" data-toggle="tooltip" data-placement="auto left" title="Email tool"></i>
          <% end -%>
          <% if action_page.enable_congress_message? %>
            <i class="icon ion-ios-filing-outline has-tooltip" data-toggle="tooltip" data-placement="auto left" title="Message Congress tool"></i>
          <% end -%>
          <% if action_page.enable_tweet? %>
            <i class="icon ion-social-twitter-outline has-tooltip" data-toggle="tooltip" data-placement="auto left" title="Tweet tool"></i>
          <% end -%>
          <% if action_page.enable_redirect? %>
            <i class="icon ion-ios-redo-outline has-tooltip" data-toggle="tooltip" data-placement="auto left" title="Standalone campaign"></i>
          <% end -%>
        </td>
        <td class="action-titles">
          <%= action_page.title -%>&nbsp;&nbsp;
          <% if !action_page.published? -%>
            <span class="label label-warning">Draft</span>
          <% end -%>
          <% if action_page.archived? -%>
            <span class="label label-default">Archived</span>
          <% end -%>
          <% if action_page.victory? -%>
            <span class="label label-success">Victory!</span>
          <% end -%>
        </td>
        <td class="action-links">
          <div class='btn-group'>
            <% if can?(:administer_actions) %>
              <%= link_to edit_admin_action_page_path(action_page),
                          class: 'btn btn-default btn-sm' do -%>
                 <i class="icon ion-ios-compose-outline"></i> Edit
              <% end %>
            <% end %>

            <%= link_to action_page_path(action_page),
               class: 'btn btn-default btn-sm', target: "_blank" do -%>
              <i class="icon ion-ios-eye"></i> View
            <% end %>

            <% if action_page.published? -%>
               <% if can?(:view_analytics) %>
                 <%= link_to edit_admin_action_page_path(action_page.id, anchor: :analytics), class: 'btn btn-default btn-sm' do -%>
                   <i class="icon ion-ios-pie-outline"></i> Analytics
                 <% end %>
               <% end %>
            <% elsif can?(:administer_actions) -%>
               <%= link_to admin_action_page_publish_path(action_page.id), class: 'btn btn-default btn-sm' do -%>
                  <i class="icon ion-ios-checkmark-empty"></i> Publish
              <% end -%>
            <% end -%>

            <% if can?(:administer_actions) %>
              <%= link_to admin_action_page_destroy_path(action_page.id), data: {confirm: "Are you sure you want to delete this? If this action has been visible to users, you might want to archive it instead of deleting. That way you can redirect the action and the URL for this action won't be broken."}, class: 'btn btn-default btn-sm' do -%>
                <i class="icon ion-ios-trash-outline"></i> <span>Delete</span>
              <% end -%>
            <% end %>
           </div>
        </td>
      </tr>
    <% end -%>
  </table>
</div>

